﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WanPiJie.WebSite.WebControls
{
	public partial class BabySummary : System.Web.UI.UserControl
	{
		public int BabyId { get; private set; }
		public Baby Baby { get; set; }
		public GrowthRecord LastGrowthRecord { get; set; }

		/// <summary>
		/// 显示查看宝宝信息链接
		/// </summary>
		public bool EnableViewBabyInfoLink { get; set; }

		public BabySummary()
		{
			this.EnableViewBabyInfoLink = true; // 默认显示
		}

		protected void Page_Load(object sender, EventArgs e)
		{
			var page = this.Page as PageMustLogin_BabyId;
			if (page != null)
			{
				this.Baby = page.Baby;
				this.BabyId = this.Baby.Id;
			}
			else
			{
				var page2 = this.Page as PageMustLogin_Baby;
				if (page2 != null)
				{
					this.Baby = page2.Baby;
					this.BabyId = this.Baby.Id;
				}
			}
			this.LastGrowthRecord = WpjSf.GrowthRecordService.GetLastGrowthRecord(this.Baby.Id);
		}
	}
}